home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / lang / c--c0202 / gus.h-- < prev    next >
Encoding:
Text File  |  1993-07-28  |  8.0 KB  |  308 lines

  1. /*
  2.     SPHINX Programming (C) 1993.
  3.     TITLE:  GUS.H--
  4.     DESCRIPTION:  This file contains a collection of procedures for accessing
  5.                   the YEA_GUS driver.  The YEA_GUS allows access to many
  6.                   features of the Gravis Ultra Sound.
  7.                   YEA_GUS must be run with the parameter 'GUS' followed by
  8.                   the name of your program and any parameters that should be
  9.                   passed to your program.  YEA_GUS will then initialize
  10.                   your Gravis Ultra Sound and spawn your application.  After
  11.                   your program terminates YEA_GUS will shut down your GUS and
  12.                   also terminate.
  13.     LAST MODIFIED:  27 July 1993
  14.     PROCEDURES DEFINED IN THIS FILE:
  15.         : word GUSGETPOSITION(voice)
  16.         : word GUSGETVOLUME(voice)
  17.         : void GUSload(dataformat, flag16bit, bytes_to_send, buf_segment,
  18.                        buf_offset, dram_high, dram_low)
  19.         : void GUSplay(voice, flag16bit, looptype, begin_high, begin_low,
  20.                        loop_start_high, loop_start_low,
  21.                        loop_end_high, loop_end_low)
  22.         : void GUSrampvolume(voice,loopmode, start_volume,end_volume,
  23.                                                time_high,time_low)
  24.         : void GUSRESET(active_voices)
  25.         : void GUSrestartvoice(voice, flag16bit, looptype)
  26.         : void GUSsave(dataformat, flag16bit, bytes_to_get, buf_segment,
  27.                        buf_offset, dram_high, dram_low)
  28.         : void GUSsetbalance(voice,balance)
  29.         : void GUSsetfrequency(voice,frequency)
  30.         : void GUSsetvoiceend(voice,end_high,end_low)
  31.         : void GUSsetvolume(voice,volume)
  32.         : word GUSSTATUS()
  33.         : void GUSSTOP(voice)
  34. */
  35.  
  36.  
  37. // looptype value:
  38. enum { GUS_LOOP_NONE, GUS_LOOP_FORWARD, GUS_LOOP_2WAY };
  39.  
  40. // flag16bit values:
  41. enum { GUS_8_BIT, GUS_16_BIT };
  42.  
  43. // data format values:
  44. enum { GUS_NOT_2_COMP, GUS_2_COMP };
  45.  
  46.  
  47. : word GUSSTATUS ()
  48. {
  49. AX = 0x6900;
  50. $ INT 0x18
  51. }
  52. /* RETURNS:  if GUS not available for any reason:
  53.                  AX = 0
  54.              else if GUS available:
  55.                  AX = amount of DRAM on card
  56. */
  57.  
  58.  
  59. : void GUSRESET ()   // AX = number of active voices 14..32
  60. {
  61. BX = AX;
  62. AX = 0x6901;
  63. $ INT 0x18
  64. }
  65. /*  RETURNS:  AX = 0x6901
  66.               BX = number of active voices
  67. */
  68.  
  69.  
  70. : void GUSsetvolume (word voice,volume)
  71. /*
  72.     voice = voice number 0..31
  73.     volume = linear volume 0..511
  74. */
  75. {
  76. AX = 0x6902;
  77. BX = voice;
  78. CX = volume;
  79. $ INT 0x18
  80. }
  81. /* RETURNS:  AX = 0x6902
  82.              BX = voice number
  83.              CX = linear volume
  84. */
  85.  
  86.  
  87. : void GUSsetfrequency (word voice,frequency)
  88. /*
  89.     voice = voice number 0..31
  90.     frequency = frequency 0..44100
  91. */
  92. {
  93. AX = 0x6903;
  94. BX = voice;
  95. CX = frequency;
  96. $ INT 0x18
  97. }
  98. /* RETURNS:  AX = 0x6903
  99.              BX = voice number
  100.              CX = frequency
  101. */
  102.  
  103.  
  104. : void GUSsetbalance (word voice,balance)
  105. /*
  106.     voice = voice number 0..31
  107.     balance = left/right balance 0..15,  7 for even
  108. */
  109. {
  110. AX = 0x6904;
  111. BX = voice;
  112. CX = balance;
  113. $ INT 0x18
  114. }
  115. /* RETURNS:  AX = 0x6904
  116.              BX = voice number
  117.              CX = balance value
  118. */
  119.  
  120.  
  121. : void GUSplay (word voice, flag16bit, looptype, begin_high, begin_low,
  122.               loop_start_high, loop_start_low, loop_end_high, loop_end_low)
  123. /*
  124.     voice = voice number 0..31
  125.     flag16bit = 0 if 8 bit, 1 if 16 bit
  126.     looptype = loop type (0 for no looping,1 for forward looping,
  127.                           2 for back and forith looping)
  128.     begin_high = high 4 bits of 20 bit voice start DRAM address
  129.     begin_low = low 16 bits of 20 bit voice start DRAM address
  130.     loop_start_high = high 4 bits of 20 bit voice loop start DRAM address
  131.     loop_start_low = low 16 bits of 20 bit voice loop start DRAM address
  132.     loop_end_high = high 4 bits of 20 bit voice loop end DRAM address
  133.     loop_end_low = low 16 bits of 20 bit voice loop end DRAM address
  134. */
  135. {
  136. AX = 0x6905;
  137. BL = voice;
  138. BH = flag16bit;
  139. CL = looptype;
  140. CH = begin_high;
  141. DI = begin_low;
  142. DL = loop_start_high;
  143. SI = loop_start_low;
  144. DH = loop_end_high;
  145. BP = loop_end_low;
  146. $ INT 0x18
  147. }
  148. /* RETURNS:  AX = 0x6905
  149.              BL = voice number (0 to 31)
  150.              BH = 8 or 16 bit data (0 if 8 bit, 1 if 16 bit)
  151.              CL = loop type (0 for no looping,
  152.                              1 for forward looping,
  153.                              2 for back and forith looping)
  154.              CH = high 4 bits of 20 bit voice start address
  155.              DI = low 16 bits of 20 bit voice start address
  156.              DL = high 4 bits of 20 bit voice loop start address
  157.              SI = low 16 bits of 20 bit voice loop start address
  158.              DH = high 4 bits of 20 bit voice loop end address
  159. */
  160.  
  161.  
  162. : void GUSload (word dataformat, flag16bit, bytes_to_send, buf_segment,
  163.                      buf_offset, dram_high, dram_low)
  164. {
  165. ES = buf_segment;
  166. SI = buf_offset;
  167. AX = 0x6906;
  168. BL = dataformat;
  169. BH = flag16bit;
  170. CX = bytes_to_send;
  171. DL = dram_high;
  172. DI = dram_low;
  173. $ INT 0x18
  174. }
  175. /* RETURNS:  AX = 0x6906
  176.              BL = data format (0 if not in 2's comp., 1 if so)
  177.              BH = 8 or 16 bit data (0 if 8 bit, 1 if 16 bit)
  178.              CX = # of bytes to send
  179.              ES = segment address of buffer to load from
  180.              SI = offset address of buffer to load from
  181.              DL = high 4 bits of 20 bit GUS DRAM address to load into
  182.              DI = low 16 bits of 20 bit GUS DRAM address to load into
  183. */
  184.  
  185.  
  186. : void GUSSTOP ()   // AX = voice number (0..31)
  187. {
  188. BX = AX;
  189. AX = 0x6907;
  190. $ INT 0x18
  191. }
  192. /* RETURNS:  AX = 0x6907
  193.              BX = voice number
  194. */
  195.  
  196.  
  197. : void GUSsetvoiceend (word voice,end_high,end_low)
  198. /*
  199.     voice = voice number 0..31
  200. */
  201. {
  202. AX = 0x6908;
  203. BX = voice;
  204. CL = end_high;
  205. DX = end_low;
  206. $ INT 0x18
  207. }
  208. /* RETURNS:  AX = 0x6908
  209.              BX = voice number
  210.              CL = end_high
  211.              DX = end_low
  212. */
  213.  
  214.  
  215. : void GUSrampvolume (word voice,loopmode,start_volume,end_volume,
  216.                                             time_high,time_low)
  217. /*
  218.     voice = voice number 0..31
  219. */
  220. {
  221. AX = 0x6909;
  222. BL = voice;
  223. BH = loopmode;
  224. CX = start_volume;
  225. DX = end_volume;
  226. DI = time_high;
  227. SI = time_low;
  228. $ INT 0x18
  229. }
  230. /* RETURNS:  AX = 0x6909
  231.              BL = voice number
  232.              BH = loopmode
  233.              CX = start_volume
  234.              DX = end_volume
  235.              DI = time_high
  236.              SI = time_low
  237. */
  238.  
  239.  
  240. : word GUSGETVOLUME ()  // AX = voice number (0..31)
  241. {
  242. BX = AX;
  243. AX = 0x690A;
  244. $ INT 0x18
  245. }
  246. /* RETURNS:  AX = current non-linear volume for specified voice
  247.              BX = voice
  248. */
  249.  
  250.  
  251.  
  252. : word GUSGETPOSITION ()    // AX = voice number (0..31)
  253. {
  254. BX = AX;
  255. AX = 0x690B;
  256. $ INT 0x18
  257. }
  258. /* RETURNS:  AX = low 16 bits of address
  259.              BX = high 4 bits of address
  260. */
  261.  
  262.  
  263. : void GUSsave (word dataformat, flag16bit, bytes_to_get, buf_segment,
  264.                      buf_offset, dram_high, dram_low)
  265. {
  266. ES = buf_segment;
  267. SI = buf_offset;
  268. AX = 0x690C;
  269. BL = dataformat;
  270. BH = flag16bit;
  271. CX = bytes_to_get;
  272. DL = dram_high;
  273. DI = dram_low;
  274. $ INT 0x18
  275. }
  276. /* RETURNS:  AX = 0x690C
  277.              BL = data format (0 if not in 2's comp., 1 if so)
  278.              BH = 8 or 16 bit data (0 if 8 bit, 1 if 16 bit)
  279.              CX = # of bytes to get
  280.              ES = segment address of buffer to save into
  281.              SI = offset address of buffer to save into
  282.              DL = high 4 bits of 20 bit GUS DRAM address to load from
  283.              DI = low 16 bits of 20 bit GUS DRAM address to load from
  284. */
  285.  
  286.  
  287. : void GUSrestartvoice (word voice,datatype,looptype)
  288. /*
  289.     voice = voice number 0..31
  290.     datatype = 0 if 8 bit, 1 if 16 bit
  291.     looptype = loop type (0 for no looping,
  292.                           1 for forward looping,
  293.                           2 for back and forith looping)
  294. */
  295. {
  296. AX = 0x690D;
  297. BX = voice;
  298. CX = datatype;
  299. DX = looptype;
  300. $ INT 0x18
  301. }
  302. /* RETURNS:  AX = 0x6904
  303.              BX = voice number
  304.              CX = balance value
  305. */
  306.  
  307.  
  308. /* end of GUS.H-- */